package org.example.service.impl;

import org.example.service.UserService;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Override
    public void add() {

    }

    @Override
    public void delete() {

    }

    @Override
    public void delete(int i) {
        System.out.println("执行删除操作");
    }

    @Override
    public String getName() {
        System.out.println("有返回值的方法");

        //System.out.println(10/0);// 手动创建一个空指针异常

        return "abcdefghijk";
    }

    @Override
    public void getById() {
        StringBuilder s = new StringBuilder();
        for (int i = 0; i < 100; i++) {
            // 用字符串的拼接模拟连接数据库取数据的过程
            StringBuilder append = s.append(i);
        }
    }

    @Override
    public void getByAll() {
        StringBuilder s = new StringBuilder();
        for (int i = 0; i < 1000; i++) {
            // 用字符串的拼接模拟连接数据库取数据的过程
            StringBuilder append = s.append(i);
        }
    }
}
